package main

import (
	"context"
	"log"

	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"

	"gitee.com/keion8620/go-zero-lean/traning/2-6/user"
)

func main() {
	conn, err := grpc.NewClient("127.0.0.1:8080", grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		log.Fatal("创建客户端失败", err)
	}
	defer conn.Close()

	userClient := user.NewUserServiceClient(conn)
	resp, err := userClient.GetUserInfo(context.Background(), &user.GetUserReq{Id: "2"})
	if err != nil {
		log.Fatal("调用服务失败", err)
	}
	log.Println(resp)
}
